//
//  TextRotation.swift
//  SwiftUIText
//
//  Created by 李煜 on 2024/7/30.
//

import SwiftUI

struct TextRotation: View {
    var body: some View {
        // 多行文字
        Text("Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma—which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition.")
            .fontWeight(.bold)
            .font(.title)
            .foregroundStyle(.gray)
        // 居中对齐
            .multilineTextAlignment(.center)
        // 限制行数 .lineLimit(nil)默认是nil
        // .lineLimit(3)
        // 截断文字
            .truncationMode(.head)
        // 行间距
            .lineSpacing(10)
        // 内边距
            .padding()
        //                .rotationEffect(.degrees(45))
        // 特定角度旋转
        //                .rotationEffect(.degrees(45), anchor: UnitPoint(x: 0, y: 0))
            .rotation3DEffect(
                .degrees(60), axis: (x: 1, y: 0, z: 0)
            )
            .shadow(color: .gray, radius: 2, x: 0, y: 15)

    }
}

#Preview {
    TextRotation()
}
